﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.QualitySettings
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine.Bindings;
using UnityEngine.Internal;
using UnityEngine.Rendering;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Script interface for.</para>
  /// </summary>
  [StaticAccessor("GetQualitySettings()", StaticAccessorType.Dot)]
  [NativeHeader("Runtime/Graphics/QualitySettings.h")]
  [NativeHeader("Runtime/Misc/PlayerSettings.h")]
  public sealed class QualitySettings : Object
  {
    /// <summary>
    ///   <para>Increase the current quality level.</para>
    /// </summary>
    /// <param name="applyExpensiveChanges">Should expensive changes be applied (Anti-aliasing etc).</param>
    public static void IncreaseLevel([DefaultValue("false")] bool applyExpensiveChanges)
    {
      QualitySettings.SetQualityLevel(QualitySettings.GetQualityLevel() + 1, applyExpensiveChanges);
    }

    /// <summary>
    ///   <para>Decrease the current quality level.</para>
    /// </summary>
    /// <param name="applyExpensiveChanges">Should expensive changes be applied (Anti-aliasing etc).</param>
    public static void DecreaseLevel([DefaultValue("false")] bool applyExpensiveChanges)
    {
      QualitySettings.SetQualityLevel(QualitySettings.GetQualityLevel() - 1, applyExpensiveChanges);
    }

    public static void SetQualityLevel(int index) => QualitySettings.SetQualityLevel(index, true);

    public static void IncreaseLevel() => QualitySettings.IncreaseLevel(false);

    public static void DecreaseLevel() => QualitySettings.DecreaseLevel(false);

    [Obsolete("Use GetQualityLevel and SetQualityLevel", false)]
    public static QualityLevel currentLevel
    {
      get => (QualityLevel) QualitySettings.GetQualityLevel();
      set => QualitySettings.SetQualityLevel((int) value, true);
    }

    private QualitySettings()
    {
    }

    /// <summary>
    ///   <para>The maximum number of pixel lights that should affect any object.</para>
    /// </summary>
    public static extern int pixelLightCount { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Real-time Shadows type to be used.</para>
    /// </summary>
    [NativeProperty("ShadowQuality")]
    public static extern ShadowQuality shadows { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Directional light shadow projection.</para>
    /// </summary>
    public static extern ShadowProjection shadowProjection { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Number of cascades to use for directional light shadows.</para>
    /// </summary>
    public static extern int shadowCascades { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Shadow drawing distance.</para>
    /// </summary>
    public static extern float shadowDistance { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The default resolution of the shadow maps.</para>
    /// </summary>
    [NativeProperty("ShadowResolution")]
    public static extern ShadowResolution shadowResolution { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The rendering mode of Shadowmask.</para>
    /// </summary>
    [NativeProperty("ShadowmaskMode")]
    public static extern ShadowmaskMode shadowmaskMode { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Offset shadow frustum near plane.</para>
    /// </summary>
    public static extern float shadowNearPlaneOffset { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The normalized cascade distribution for a 2 cascade setup. The value defines the position of the cascade with respect to Zero.</para>
    /// </summary>
    public static extern float shadowCascade2Split { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The normalized cascade start position for a 4 cascade setup. Each member of the vector defines the normalized position of the coresponding cascade with respect to Zero.</para>
    /// </summary>
    public static Vector3 shadowCascade4Split
    {
      get
      {
        Vector3 ret;
        QualitySettings.get_shadowCascade4Split_Injected(out ret);
        return ret;
      }
      set => QualitySettings.set_shadowCascade4Split_Injected(ref value);
    }

    /// <summary>
    ///   <para>Global multiplier for the LOD's switching distance.</para>
    /// </summary>
    [NativeProperty("LODBias")]
    public static extern float lodBias { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Global anisotropic filtering mode.</para>
    /// </summary>
    [NativeProperty("AnisotropicTextures")]
    public static extern AnisotropicFiltering anisotropicFiltering { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>A texture size limit applied to most textures. Indicates how many mipmaps should be dropped. The default value is zero.</para>
    /// </summary>
    public static extern int masterTextureLimit { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>A maximum LOD level. All LOD groups.</para>
    /// </summary>
    public static extern int maximumLODLevel { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Budget for how many ray casts can be performed per frame for approximate collision testing.</para>
    /// </summary>
    public static extern int particleRaycastBudget { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Should soft blending be used for particles?</para>
    /// </summary>
    public static extern bool softParticles { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Use a two-pass shader for the vegetation in the terrain engine.</para>
    /// </summary>
    public static extern bool softVegetation { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The number of vertical syncs that should pass between each frame.</para>
    /// </summary>
    public static extern int vSyncCount { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>How much CPU usage to assign to the final lighting calculations at runtime.</para>
    /// </summary>
    public static extern int realtimeGICPUUsage { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Choose the level of Multi-Sample Anti-aliasing (MSAA) that the GPU performs.</para>
    /// </summary>
    public static extern int antiAliasing { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///         <para>Async texture upload provides timesliced async texture upload on the render thread with tight control over memory and timeslicing. There are no allocations except for the ones which driver has to do. To read data and upload texture data a ringbuffer whose size can be controlled is re-used.
    /// 
    /// Use asyncUploadTimeSlice to set the time-slice in milliseconds for asynchronous texture uploads per
    /// frame. Minimum value is 1 and maximum is 33.</para>
    ///       </summary>
    public static extern int asyncUploadTimeSlice { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///         <para>Asynchronous texture and mesh data upload provides timesliced async texture and mesh data upload on the render thread with tight control over memory and timeslicing. There are no allocations except for the ones which driver has to do. To read data and upload texture and mesh data, Unity re-uses a ringbuffer whose size can be controlled.
    /// 
    /// Use asyncUploadBufferSize to set the buffer size for asynchronous texture and mesh data uploads. The minimum value is 2 megabytes and the maximum value is 2047 megabytes. The buffer resizes automatically to fit the largest texture currently loading. To avoid a buffer resize (which can use extra system resources) set this value to the size of the largest texture in the Scene. If you have issues with excessive memory usage, you may need to reduce the value of this buffer or disable asyncUploadPersistentBuffer. Memory fragmentation can occur if you choose the latter option.</para>
    ///       </summary>
    public static extern int asyncUploadBufferSize { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///         <para>This flag controls if the async upload pipeline's ring buffer remains allocated when there are no active loading operations.
    /// Set this to true, to make the ring buffer allocation persist after all upload operations have completed.
    /// If you have issues with excessive memory usage, you can set this to false. This means you reduce the runtime memory footprint, but memory fragmentation can occur.
    /// The default value is true.</para>
    ///       </summary>
    public static extern bool asyncUploadPersistentBuffer { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Sets the QualitySettings.lodBias|lodBias and QualitySettings.maximumLODLevel|maximumLODLevel at the same time.</para>
    /// </summary>
    /// <param name="lodBias">Global multiplier for the LOD's switching distance.</param>
    /// <param name="maximumLODLevel">A maximum LOD level. All LOD groups.</param>
    /// <param name="setDirty">If true, marks all views as dirty.</param>
    [NativeName("SetLODSettings")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void SetLODSettings(float lodBias, int maximumLODLevel, bool setDirty = true);

    /// <summary>
    ///   <para>Enables real-time reflection probes.</para>
    /// </summary>
    public static extern bool realtimeReflectionProbes { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>If enabled, billboards will face towards camera position rather than camera orientation.</para>
    /// </summary>
    public static extern bool billboardsFaceCameraPosition { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>In resolution scaling mode, this factor is used to multiply with the target Fixed DPI specified to get the actual Fixed DPI to use for this quality setting.</para>
    /// </summary>
    public static extern float resolutionScalingFixedDPIFactor { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    [NativeName("RenderPipeline")]
    private static extern ScriptableObject INTERNAL_renderPipeline { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The RenderPipelineAsset that defines the override render pipeline for the current quality level.</para>
    /// </summary>
    public static RenderPipelineAsset renderPipeline
    {
      get => QualitySettings.INTERNAL_renderPipeline as RenderPipelineAsset;
      set => QualitySettings.INTERNAL_renderPipeline = (ScriptableObject) value;
    }

    [NativeName("GetRenderPipelineAssetAt")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern ScriptableObject InternalGetRenderPipelineAssetAt(int index);

    /// <summary>
    ///   <para>Provides a reference to the RenderPipelineAsset that defines the override render pipeline for a given quality level. </para>
    /// </summary>
    /// <param name="index">Index of the quality level.</param>
    /// <returns>
    ///   <para>Returns null if the quality level does not exist, or if no asset is assigned to that quality level. Otherwise, returns the RenderPipelineAsset that defines the override render pipeline for the quality level.</para>
    /// </returns>
    public static RenderPipelineAsset GetRenderPipelineAssetAt(int index)
    {
      if (index < 0 || index >= QualitySettings.names.Length)
        throw new IndexOutOfRangeException(string.Format("{0} is out of range [0..{1}[", (object) nameof (index), (object) QualitySettings.names.Length));
      return QualitySettings.InternalGetRenderPipelineAssetAt(index) as RenderPipelineAsset;
    }

    [Obsolete("blendWeights is obsolete. Use skinWeights instead (UnityUpgradable) -> skinWeights", true)]
    public static extern BlendWeights blendWeights { [NativeName("GetSkinWeights"), MethodImpl(MethodImplOptions.InternalCall)] get; [NativeName("SetSkinWeights"), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The maximum number of bones per vertex that are taken into account during skinning, for all meshes in the project.</para>
    /// </summary>
    public static extern SkinWeights skinWeights { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Enable automatic streaming of texture mipmap levels based on their distance from all active cameras.</para>
    /// </summary>
    public static extern bool streamingMipmapsActive { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The total amount of memory (in megabytes) to be used by streaming and non-streaming textures.</para>
    /// </summary>
    public static extern float streamingMipmapsMemoryBudget { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The number of renderer instances that are processed each frame when calculating which texture mipmap levels should be streamed.</para>
    /// </summary>
    public static extern int streamingMipmapsRenderersPerFrame { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The maximum number of mipmap levels to discard for each texture.</para>
    /// </summary>
    public static extern int streamingMipmapsMaxLevelReduction { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Process all enabled Cameras for texture streaming (rather than just those with StreamingController components).</para>
    /// </summary>
    public static extern bool streamingMipmapsAddAllCameras { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The maximum number of active texture file IO requests from the texture streaming system.</para>
    /// </summary>
    public static extern int streamingMipmapsMaxFileIORequests { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Maximum number of frames queued up by graphics driver.</para>
    /// </summary>
    [StaticAccessor("QualitySettingsScripting", StaticAccessorType.DoubleColon)]
    public static extern int maxQueuedFrames { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Returns the current graphics quality level.</para>
    /// </summary>
    [NativeName("GetCurrentIndex")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern int GetQualityLevel();

    /// <summary>
    ///   <para>Provides a reference to the QualitySettings object.</para>
    /// </summary>
    /// <returns>
    ///   <para>Returns the QualitySettings object.</para>
    /// </returns>
    [FreeFunction]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern Object GetQualitySettings();

    /// <summary>
    ///   <para>Sets a new graphics quality level.</para>
    /// </summary>
    /// <param name="index">Quality index to set.</param>
    /// <param name="applyExpensiveChanges">Should expensive changes be applied (Anti-aliasing etc).</param>
    [NativeName("SetCurrentIndex")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void SetQualityLevel(int index, [DefaultValue("true")] bool applyExpensiveChanges);

    /// <summary>
    ///   <para>The indexed list of available Quality Settings.</para>
    /// </summary>
    [NativeProperty("QualitySettingsNames")]
    public static extern string[] names { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    [NativeName("IsTextureResReducedOnAnyPlatform")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern bool IsTextureResReducedOnAnyPlatform();

    [NativeName("GetRenderPipelineAssetsForPlatform")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern ScriptableObject[] InternalGetRenderPipelineAssetsForPlatform(
      string buildTargetGroupName);

    public static void GetAllRenderPipelineAssetsForPlatform(
      string buildTargetGroupName,
      ref List<RenderPipelineAsset> renderPipelineAssets)
    {
      if (renderPipelineAssets == null)
        renderPipelineAssets = new List<RenderPipelineAsset>();
      foreach (ScriptableObject scriptableObject in QualitySettings.InternalGetRenderPipelineAssetsForPlatform(buildTargetGroupName))
      {
        if (scriptableObject is RenderPipelineAsset renderPipelineAsset)
          renderPipelineAssets.Add(renderPipelineAsset);
        else
          renderPipelineAssets.Add(GraphicsSettings.defaultRenderPipeline);
      }
    }

    /// <summary>
    ///   <para>Desired color space (Read Only).</para>
    /// </summary>
    public static extern ColorSpace desiredColorSpace { [StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot), NativeName("GetColorSpace"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Active color space (Read Only).</para>
    /// </summary>
    public static extern ColorSpace activeColorSpace { [NativeName("GetColorSpace"), StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot), MethodImpl(MethodImplOptions.InternalCall)] get; }

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void get_shadowCascade4Split_Injected(out Vector3 ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void set_shadowCascade4Split_Injected(ref Vector3 value);
  }
}
